<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware(['api'])->namespace('App\Http\Controllers\Api')->group(function () {
    Route::any('captcha', 'LoginController@captcha')->name('api.captcha');
    Route::any('login', 'LoginController@login')->name('api.login');
    Route::any('index', 'IndexController@index')->name('api.index');
});
Route::middleware(['auth:sanctum', 'api'])->get('/user', function (Request $request) {
    return $request->user();
});
Route::middleware(['auth:sanctum', 'api'])->namespace('App\Http\Controllers\Api')->group(function () {
    Route::any('article/info', 'IndexController@articleInfo')->name('api.article.info');
    Route::any('article', 'IndexController@article')->name('api.article');
    Route::any('user/getUploadConfig', 'UserController@getUploadConfig')->name('api.getUploadConfig');
    Route::any('user/attachmentAdd', 'UserController@attachmentAdd')->name('api.attachmentAdd');
    Route::any('user/attachmentDelete', 'UserController@attachmentDelete')->name('api.attachmentDelete');
    Route::any('res/index', 'ResController@index')->name('api.res.index');
    Route::any('res/getNoUserAttachment', 'ResController@getNoUserAttachment')->name('api.res.getNoUserAttachment');
    Route::any('res/my', 'ResController@my')->name('api.res.my');
    Route::any('res/delete', 'ResController@delete')->name('api.res.delete');
    Route::any('res/add', 'ResController@add')->name('api.res.add');
    Route::any('res/info', 'ResController@info')->name('api.res.info');
});
